<?php
$currency = new Zend_Currency('vi_VN');
$item = $this->item;
$thumbnails = json_decode($item['thumbnails']);
$url = $this->url(array('module' => 'bid', 'controller' => 'item', 'action' => 'detail', 'id' => $item['id']), 'default', true);
$reservePrice = $this->common()->trimCurrency($currency->toCurrency($item['reserve_price'], array('symbol' => '')));
$remainingTime = $this->common()->dateCalcDiff(time(), strtotime($item['end_date']));
$timeLeft = '';
if(count($remainingTime)) {
    // round number
    if(isset($remainingTime['day']) && $remainingTime['day']) {
        $timeLeft = $remainingTime['day'] . ' ngày';
    }
    if(isset($remainingTime['hour']) && $remainingTime['hour']) {
        $timeLeft .= ' ' . $remainingTime['hour'] . ' giờ';
    }
    if(isset($remainingTime['minute']) && $remainingTime['minute']) {
        $timeLeft .= ' ' . $remainingTime['minute'] . ' phút';
    }
}
else {
    $timeLeft = 'N/A';
}
?>
<div class="itemDetail">
	<p><a href="<?php echo $url; ?>"><img src="<?php echo $this->baseUrl() . '/uploads/images/bid/thumbnails/' . $thumbnails->thumb_home; ?>" width="218" alt="<?php echo $item['title']; ?>" /></a></p>
	<p class="title"><a href="<?php echo $url; ?>"><?php echo $item['title']; ?></a></p>
	<p class="price"><?php echo $reservePrice; ?><span>đ</span></p>
	<p class="detail"><span class="timeLeft"><?php echo $timeLeft; ?></span><span class="flag">14 lượt đấu</span></p>
</div>